﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zor_IDAL;

namespace Zor_DAL
{
    public class Sincerity_DAL<T> where T : class
    {
        /// <summary>
        /// 根据用户ID获取用户信息
        /// </summary>
        /// <param name="user_Id">用户ID</param>
        /// <returns></returns>
        public static T GetApiUserByUserID(string user_Id)
        {
            string sql = "select a.User_Id,a.user_username, a.DT_Id ,b.Dt_Name,b.Dt_ParentID,b.Dt_Level ";
            sql += "from  Sys_Users a left join Sys_Department b ";
            sql += "on a.DT_ID=b.Dt_Id ";
            sql += "where a.user_Id=@user_Id";
            return DapperQuery<T>.DoQueryT(sql, new { user_Id = user_Id });
        }
        /// <summary>
        /// 根据父ID获取用户便利店
        /// </summary>
        /// <param name="Dt_ParentID">父ID</param>
        /// <returns></returns>
        public static T GetApiUserByParentID(string Dt_ParentID)
        {
            string sql = "select a.User_Id,a.user_username, a.DT_Id ,b.Dt_Name,b.Dt_ParentID,b.Dt_Level ";
            sql += "from  Sys_Users a left join Sys_Department b ";
            sql += "on a.DT_ID=b.Dt_Id ";
            sql += "where b.Dt_ParentID=@Dt_ParentID";
            return DapperQuery<T>.DoQueryT(sql, new { Dt_ParentID = Dt_ParentID });
        }

    }
}
